//
//  U9RadiusImageView.m
//  U9WatchGame
//
//  Created by uuu9 on 2017/6/20.
//  Copyright © 2017年 UUU9. All rights reserved.
//

#import "U9RadiusImageView.h"

@implementation U9RadiusImageView

- (void)drawRect:(CGRect)rect {
    [super drawRect:rect];
    UIBezierPath *p = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:(_bottomLeftRadius?UIRectCornerBottomLeft:0)|(_bottomRightRadius?UIRectCornerBottomRight:0)|(_topLeftRadius?UIRectCornerTopLeft:0)|(_topRightRadius?UIRectCornerTopRight:0) cornerRadii:CGSizeMake(_cornerRadius, 0.f)];
    CGContextRef c = UIGraphicsGetCurrentContext();
    CGContextAddPath(c, p.CGPath);
    CGContextClosePath(c);
    CGContextClip(c);
    CGContextAddRect(c, rect);
//    CGContextSetFillColorWithColor(c, _bgColor.CGColor);
    CGContextFillPath(c);
}

@end
